package me.zxk.smartagriculture.dto.note;

import lombok.Data;

import java.time.LocalDateTime;

/**
 * 便签响应DTO
 */
@Data
public class NoteResponse {

    private Long id;
    private String title;
    private String content;
    private LocalDateTime createTime;
    private LocalDateTime updateTime;

    /**
     * 从实体转换为响应DTO
     */
    public static NoteResponse fromEntity(me.zxk.smartagriculture.entity.Note note) {
        NoteResponse response = new NoteResponse();
        response.setId(note.getId());
        response.setTitle(note.getTitle());
        response.setContent(note.getContent());
        response.setCreateTime(note.getCreateTime());
        response.setUpdateTime(note.getUpdateTime());
        return response;
    }
}
